import request from 'utils/request'

// 获取文章列表
export const getarticle = (params) => {
  return request({
    url: '/mp/articles',
    method: 'get',
    params,
  })
}

// 删除文章
export const delArticle = (id) => {
  return request({
    url: `/mp/articles/${id}`,
    method: 'DELETE',
  })
}

// 添加文章
export const addArticle = (data, draft = false) => {
  return request.post(`/mp/articles?draft=${draft}`, data)
}

// 添加文章
export const EditArticle = (id) => {
  return request.get(`/mp/articles/${id}`)
}

// 修改文章
export const updateArticle = (data, draft = false) => {
  return request.put(`/mp/articles/${data.id}?draft=${draft}`, data)
}
